require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_html'

require 'hpricot'
require 'syntax/convertors/html'


module Content
  class TextField < Field
    def editable
      raise "Already called editable." if @already_called
      @already = true
      e :textarea,
        :name => form_field_name,
        :innerHTML => CGI.escapeHTML(value||""),
        :rows => (value || "").count("\n")+5,
        :cols => 55
    end

    def static
      add format(value)
    end
  
    def format input_string
      p = SM::SimpleMarkup.new
      h = SM::ToHtml.new
      p.convert(input_string, h)
    end
  end
end